<?php if (isset($add)) echo "<h2>Thêm Tiện Ích</h2>"; else echo "<h2>Thay đổi Tiện Ích</h2>";?>
<form name="edit_facility" action="?act=createOrModifyFacility&facility_id=<?php echo (isset($facility_id)? $facility_id:"")  ?>" method="POST" onsubmit="return validate_values()" enctype="multipart/form-data">
	<div class='row_field'>
    	<div class='label'>
			<label for="news_name">Danh mục (*):</label>
        </div>
        <div class='field'>
			<input class='inputbox' type="text" id="category" name="category"  value="<?php echo $facility->getcategory() ?>">
        </div>
	</div>
	
    <div class='row_field'>
    	<div class='label'>
			<label for="thumbnail">Mô tả (*):</label>
        </div>
		<div class='field'>
			<textarea class='inputbox' type="file" id="description" name="description"><?php echo $facility->getdescription()?></textarea>
        </div>
    </div>

	<div class='row_field'>
    	<div class='label'>
			<label for="facility_for">Loại tiện ích:</label>
        </div>
		<div class='field'>
			<select id="facility_for" name="facility_for">
				<option <?php if ($facility->getfacility_for() == 'HOTEL') echo 'selected="selected"';?> value="HOTEL">Khách sạn</option>
				<option <?php if ($facility->getfacility_for() == 'ROOM') echo 'selected="selected"';?> value="ROOM">Phòng</option>
			</select>
        </div>
    </div>
    
	<div class='row_field'><p>(*) Thông tin bắt buộc</p></div>
	<div class='row_field'>
		<input type="submit" value="Save">
		<input type="reset" value="Reset">
	</div>
	
</form>
<script type="text/javascript">
	function validate_values() {
		category = $('#category').val();
		description = $('#description').val();
		
		message = "Các mục sau đây là bắt buộc hoặc sai giá trị: \n";
		ok = true;
		if (category == "") {
			message += "Danh mục \n";
			ok = false;
		}
		if (!ok) alert(message);
		return ok;
	}
</script>